package com.zgt.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zgt.dao.ResearchDao;
import com.zgt.model.Research;
import com.zgt.service.ResearchService;
import com.zgt.util.Page;

@Service("researchService")
public class ResearchServiceImpl implements ResearchService {

	private ResearchDao researchDao;

	public ResearchDao getResearchDao() {
		return researchDao;
	}

	@Resource
	public void setResearchDao(ResearchDao researchDao) {
		this.researchDao = researchDao;
	}

	public void deleteResearchById(int id) {
		researchDao.deleteResearchById(id);
	}

	public Research getResearchById(int id) {
		return researchDao.getResearchById(id);
	}

	public void addResearch(Research research) {
		researchDao.saveResearch(research);
	}

	public void updateResearch(Research research) {
		researchDao.updateResearch(research);
	}

	public List<Research> listAllResearch() {
		return researchDao.listAllResearch();
	}
	
	public Page listResearch(Page page) {
		page.setAllRow(researchDao.getCount());
		List<Research> list = researchDao.listResearch(page.getOffset(), page
				.getPageSize());
		page.setPageResult(list);
		return page;
	}

}